package com.igormaznitsa.elife;

import java.awt.Dimension;
import java.awt.Toolkit;

/**
 * The class implements a JDialog to show the about dialog for the E-Life
 * example
 *
 * @author Igor Maznitsa (igor.maznitsa@igormaznitsa.com)
 * @version 1.00
 */
public class AboutDialog extends javax.swing.JDialog {

  private static final long serialVersionUID = -4621824404731323441L;

  /**
   * Creates new form AboutDialog
   *
   * @param parent
   * @param modal
   */
  public AboutDialog(final java.awt.Frame parent, final boolean modal) {
    super(parent, modal);
    initComponents();

    final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    final int thisWidth = getWidth();
    final int thisHeight = getHeight();
    setLocation((screenSize.width - thisWidth) / 2, (screenSize.height - thisHeight) / 2);
  }

  /**
   * This method is called from within the constructor to initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is always
   * regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        closeButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        textOutArea = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("About");

        closeButton.setText("Close");
        closeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                closeButtonActionPerformed(evt);
            }
        });

        textOutArea.setColumns(20);
        textOutArea.setEditable(false);
        textOutArea.setLineWrap(true);
        textOutArea.setRows(5);
        textOutArea.setText("E-Life example\nversion 1.00\n\nauthor: Igor Maznitsa (igor.maznitsa@igormaznitsa.com)\n\nhttp://www.igormaznitsa.com\n\n---------------------------------\nThe application implements the standard life game.\nThe example was developed to show possibilities of intercommunnication between the Prol engine (an embeddable java prolog enterpreter) and Java.");
        textOutArea.setWrapStyleWord(true);
        jScrollPane1.setViewportView(textOutArea);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(closeButton, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(closeButton)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
      this.dispose();
    }//GEN-LAST:event_closeButtonActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton closeButton;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea textOutArea;
    // End of variables declaration//GEN-END:variables

}
